package com.netease.pris.activity;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.a.i;
import com.netease.pris.activity.a.t;
import com.netease.pris.activity.view.NeteaseListView;
import com.netease.pris.app.PrisApp;
import com.netease.pris.atom.u;
import com.netease.pris.b;
import com.netease.pris.b.a;
import com.netease.pris.d.c;
import com.netease.pris.v;
import java.util.Iterator;
import java.util.LinkedList;

public class FavoriteListActivity extends ActivityEx
{
  public static final int a = 0;
  public static final int b = 1;
  public static final int c = 1;
  public static final int d = 0;
  public static final int e = 1;
  private static final String k = "FavoriteListActivity";
  private View A;
  private LinearLayout B;
  private ProgressBar C;
  private TextView D;
  private AdapterView.OnItemClickListener E = new bf(this);
  DialogInterface.OnClickListener f = new bh(this);
  View.OnClickListener g = new bg(this);
  AdapterView.OnItemLongClickListener h = new bm(this);
  AbsListView.OnScrollListener i = new bk(this);
  b j = new bi(this);
  private boolean l = true;
  private boolean m = false;
  private int n = 0;
  private int o = 0;
  private String p = null;
  private String q = null;
  private com.netease.pris.protocol.d r = null;
  private Context s = null;
  private ImageView t = null;
  private LinearLayout u = null;
  private NeteaseListView v = null;
  private BaseAdapter w = null;
  private LinkedList x = null;
  private LinkedList y = null;
  private ProgressBar z = null;

  private void a(int paramInt, Object paramObject, String paramString1, String paramString2)
  {
    switch (paramInt)
    {
    case 501:
    case 503:
    default:
      return;
    case 505:
      this.n = v.a().l();
    case 500:
    case 504:
    case 502:
    }
    while (true)
    {
      this.x.add(new Integer(this.n));
      break;
      this.n = v.a().j();
      continue;
      this.n = v.a().d(paramString1);
      continue;
      this.n = v.a().e((u)paramObject);
    }
  }

  public static void a(Context paramContext)
  {
    paramContext.startActivity(new Intent(paramContext, FavoriteListActivity.class));
  }

  private void a(com.netease.pris.protocol.d paramd, boolean paramBoolean)
  {
    if ((paramd == null) || (paramd.h == null));
    while (true)
    {
      return;
      if ((this.w != null) && ((this.w instanceof t)))
      {
        if (!paramBoolean)
        {
          ((t)this.w).a();
          ((t)this.w).b(paramd.h);
          continue;
        }
        ((t)this.w).a(paramd.h);
        continue;
      }
    }
  }

  private void b(boolean paramBoolean)
  {
    if (paramBoolean)
    {
      this.B.setVisibility(0);
      this.C.setVisibility(0);
      this.D.setText(2131361949);
    }
    while (true)
    {
      return;
      this.B.setVisibility(8);
    }
  }

  private void c()
  {
    this.t = ((ImageView)findViewById(2131558408));
    this.z = ((ProgressBar)findViewById(2131558412));
    this.v = ((NeteaseListView)findViewById(2131558529));
    this.u = ((LinearLayout)findViewById(2131558531));
    this.A = LayoutInflater.from(this).inflate(2130903048, null);
    this.v.addFooterView(this.A);
    this.v.setDivider(null);
    this.v.setDividerHeight(0);
    this.v.setFooterDividersEnabled(false);
    this.B = ((LinearLayout)this.A.findViewById(2131558426));
    this.C = ((ProgressBar)this.A.findViewById(2131558427));
    this.D = ((TextView)this.A.findViewById(2131558428));
  }

  private void e()
  {
    setTitle(2131361915);
    c(k.a(this).b(2130837818));
    this.q = getResources().getString(2131361915);
  }

  private void f()
  {
    String[] arrayOfString = new String[5];
    arrayOfString[0] = "icon";
    arrayOfString[1] = "title";
    arrayOfString[2] = "time";
    arrayOfString[3] = "content";
    arrayOfString[4] = "line";
    int[] arrayOfInt = new int[5];
    arrayOfInt[0] = 2131558436;
    arrayOfInt[1] = 2131558424;
    arrayOfInt[2] = 2131558660;
    arrayOfInt[3] = 2131558525;
    arrayOfInt[4] = 2131558423;
    this.w = new t(this, 2130903110, arrayOfString, arrayOfInt);
    if (this.v != null)
      this.v.setAdapter(this.w);
  }

  private void g()
  {
    if (this.t != null)
      this.t.setOnClickListener(this.g);
    if (this.v != null)
    {
      this.v.setOnItemClickListener(this.E);
      this.v.setOnItemLongClickListener(this.h);
      this.v.setOnScrollListener(this.i);
    }
  }

  private void h()
  {
    a(505, null, null, null);
  }

  private void r()
  {
    a(500, null, null, null);
  }

  private void s()
  {
    a(502, (u)this.w.getItem(this.o), null, null);
  }

  private void t()
  {
    if (i.a(a.o(), 20, 20))
      dc.b(this.s, 2);
  }

  private void u()
  {
    if (this.p != null)
    {
      a(504, null, this.p, null);
      this.v.addFooterView(this.A);
      d_();
      b(true);
    }
  }

  public void b()
  {
    this.t.setVisibility(0);
    this.z.setVisibility(8);
  }

  public void d_()
  {
    this.t.setVisibility(8);
    this.z.setVisibility(0);
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903081);
    this.s = this;
    this.l = true;
    v.a().a(this.j);
    this.m = com.netease.b.a.d.h().i();
    this.x = new LinkedList();
    this.y = new LinkedList();
    c();
    f();
    g();
    e();
    h();
    d_();
    if (this.m)
      t();
  }

  public Dialog onCreateDialog(int paramInt)
  {
    u localu = (u)this.w.getItem(this.o);
    if (localu != null);
    for (String str = localu.U(); ; str = null)
    {
      switch (paramInt)
      {
      default:
      case 1:
      }
      AlertDialog.Builder localBuilder;
      for (AlertDialog localAlertDialog = null; ; localAlertDialog = localBuilder.create())
      {
        return localAlertDialog;
        localBuilder = new AlertDialog.Builder(this);
        localBuilder.setTitle(str);
        localBuilder.setItems(2131165189, this.f);
      }
    }
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131492865, paramMenu);
    return super.onCreateOptionsMenu(paramMenu);
  }

  public void onDestroy()
  {
    super.onDestroy();
    v.a().b(this.j);
    if (this.z != null)
      this.z.setVisibility(8);
    if (this.C != null)
      this.C.setVisibility(8);
    if (this.x != null)
      this.x.clear();
    if (this.y != null)
      this.y.clear();
    PrisApp.a().b(null);
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (paramInt == 4)
      c.a(p(), 624);
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    switch (paramMenuItem.getItemId())
    {
    default:
    case 2131558722:
    }
    while (true)
    {
      return super.onOptionsItemSelected(paramMenuItem);
      a(500, null, null, null);
      d_();
      c.a(p(), 625);
    }
  }

  public void onPrepareDialog(int paramInt, Dialog paramDialog)
  {
    u localu = (u)this.w.getItem(this.o);
    if (localu != null);
    for (String str = localu.U(); ; str = null)
    {
      switch (paramInt)
      {
      default:
      case 1:
      }
      while (true)
      {
        return;
        paramDialog.setTitle(str);
      }
    }
  }

  public void onResume()
  {
    super.onResume();
    Iterator localIterator = this.y.iterator();
    while (localIterator.hasNext())
    {
      u localu = (u)localIterator.next();
      if (this.r == null)
        continue;
      this.r.h.remove(localu);
      ((t)this.w).d(localu);
    }
    this.y.clear();
    if (this.l)
      this.l = false;
    while (true)
    {
      return;
      if (this.w.getCount() == 0)
      {
        this.u.setVisibility(0);
        continue;
      }
      this.u.setVisibility(8);
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.FavoriteListActivity
 * JD-Core Version:    0.6.0
 */